<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        background-color: #333;
      }
    </style>
  </head>
  <body>
    <button>按钮</button>
    <script>
      'use strict';
      // 内置函数(凭经验)
      setTimeout(function () {
        console.log('setTimeout', this); // window
      }, 0);

      const btnEl = document.querySelector('button');
      btnEl.addEventListener('click', function () {
        console.log('btn-click', this); // btnEl
      });

      const names = ['zhangsan', 'lisi', 'wangwu'];
      names.forEach(function (name) {
        console.log('forEach', this); // 默认：window，第二次参数可以传入this
      }, names);
    </script>
  </body>
</html>
